package com.stargazer.ming.ui;

import com.stargazer.ming.R;
import com.stargazer.ming.ui.util.CameraUtil;
import android.os.Bundle;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.view.Menu;
import android.view.View;
import android.widget.ImageView;

public class CropImageUI extends MingActivity {

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);

		initView();
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		getMenuInflater().inflate(R.menu.activity_crop_image_ui, menu);
		return true;
	}

	@Override
	protected void initView() {
		setMingTitle(R.string.title_activity_crop_image_ui);
		// title button
		setPrevBtn(R.drawable.title_camera, new View.OnClickListener() {

			@Override
			public void onClick(View v) {
				CameraUtil.showPhotoDialog(CropImageUI.this);
			}
		});
		setNextBtn(getString(R.string.next), new View.OnClickListener() {

			@Override
			public void onClick(View v) {
				startActivity(new Intent(CropImageUI.this, EditMingPostUI.class));
			}
		});
		
		ImageView imageView = (ImageView) findViewById(R.id.imageView1);
		String filePath = getIntent().getStringExtra(ConstantsUI.IMAGE_PATH);
		if (filePath != null) {
			Bitmap temp = BitmapFactory.decodeFile(filePath);
			imageView.setImageBitmap(temp);
		}
	}

	@Override
	protected int getBodyId() {
		return R.layout.activity_crop_image_ui;
	}
}
